﻿addMFolloup = function (index, status, enqid) {
    $.ajax({
        async: "false",
        url: "ajax/EnqFollowUp.aspx",
        type: "POST",
        data: { T: "UpdateStatus", userid: $("#sesuserid").val(), eid: enqid },
        success: function (data) {
            if (data != -1) {
               $("#popup_serror").html("<center><span class='green'>Enquiry added successfully.</span></center>")
            } else {
                $("#popup_serror").html("<center><span class='red'>Sorry!This Enquiry is not added to your account.</span></center>")
            }
            setTimeout("$('#popup_serror').html('')",5000)
            var tab = document.getElementById("popup_enquirygrid");
            if (tab) {
                tab.deleteRow(index);
                for (var i = 1; i < tab.rows.length; i++) {
                    tab.rows[i].cells[0].innerHTML = i;
                }
            }
        },
        error: function (error) {
            $("#popup_serror").html(error.responseText);
        }
        
    })
}
function Enquiry(pop) {
    var t;
    $.ajax({
        async: "false",
        url: "ajax/EnqFollowUp.aspx",
        type: "POST",
        data: { T: "getEnquiry", userid: $("#sesuserid").val(), status: "P", groupid: $("#sesgrpid").val(), popup: pop},
        success: function (data) {
            if (data == "-1") {
                clearTimeout(t);
            } else {
                if (data != "") {
                    $("#pop_EnquiryGrid").html(data);
                    $("#popup_enquiry").fadeIn("slow");
                    $("#enq_blank").fadeIn("slow");
                }
                if (pop == 1) {
                    t = setTimeout("Enquiry(1)", 30000);
                }
            }
        },
        error: function (error) {
            if (pop == 1) {
                clearTimeout(t);
            }
        }
    })
}
function closeenquiry() {
    $("#popup_enquiry").fadeOut("slow");
    $("#enq_blank").fadeOut("slow");
}